package com.clock.shop.service.impl;

import java.util.List;
import com.clock.common.utils.DateUtils;
import com.clock.shop.domain.ShopMember;
import com.clock.shop.mapper.ShopMemberMapper;
import com.clock.shop.service.IShopMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 会员Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-10-11
 */
@Service
public class ShopMemberServiceImpl implements IShopMemberService
{
    @Autowired
    private ShopMemberMapper shopMemberMapper;

    /**
     * 查询会员
     * 
     * @param memberId 会员主键
     * @return 会员
     */
    @Override
    public ShopMember selectShopMemberByMemberId(Long memberId)
    {
        return shopMemberMapper.selectShopMemberByMemberId(memberId);
    }

    //查询会员总数
    @Override
    public Long selectMemberNum(Long shopId)
    {
        return shopMemberMapper.selectMemberNum(shopId);
    }
    /**
     * 查询会员列表
     * 
     * @param shopMember 会员
     * @return 会员
     */
    @Override
    public List<ShopMember> selectShopMemberList(ShopMember shopMember)
    {
        return shopMemberMapper.selectShopMemberList(shopMember);
    }

    /**
     * 新增会员
     * 
     * @param shopMember 会员
     * @return 结果
     */
    @Override
    public int insertShopMember(ShopMember shopMember)
    {
        shopMember.setUpdateTime(DateUtils.getNowDate());
        return shopMemberMapper.insertShopMember(shopMember);
    }

    /**
     * 修改会员
     * 
     * @param shopMember 会员
     * @return 结果
     */
    @Override
    public int updateShopMember(ShopMember shopMember)
    {
        shopMember.setUpdateTime(DateUtils.getNowDate());
        return shopMemberMapper.updateShopMember(shopMember);
    }

    /**
     * 批量删除会员
     * 
     * @param memberIds 需要删除的会员主键
     * @return 结果
     */
    @Override
    public int deleteShopMemberByMemberIds(Long[] memberIds)
    {
        return shopMemberMapper.deleteShopMemberByMemberIds(memberIds);
    }

    /**
     * 删除会员信息
     * 
     * @param memberId 会员主键
     * @return 结果
     */
    @Override
    public int deleteShopMemberByMemberId(Long memberId)
    {
        return shopMemberMapper.deleteShopMemberByMemberId(memberId);
    }
}
